// 最近一次调整的数据状态
const auditStatusList = [
  {
    value: 0,
    label: '待提交'
  },
  {
    value: 1,
    label: '审核中'
  },
  {
    value: 2,
    label: '审核通过'
  },
  {
    value: 3,
    label: '审核不通过'
  }
]

// 节点状态
const nodeStatusList = [
  {
    value: 0,
    label: '未开始'
  },
  {
    value: 1,
    label: '正进行'
  },
  {
    value: 2,
    label: '逾期未完成'
  },
  {
    value: 3,
    label: '按期完成'
  },
  {
    value: 4,
    label: '逾期完成'
  }
]

// 搜索项
const searchOption = [
  {
    name: '业务事项',
    value: 'businessMatters',
    type: 'input'
  },
  {
    name: '节点状态',
    value: 'nodeStatus',
    type: 'select',
    data: nodeStatusList
  },
  {
    name: '所属月度',
    value: 'belongMonth',
    type: 'month',
    attr: {
      defaultValue:[]
    } 
  },
  {
    name: '计划完成时间',
    value: 'plannedCompletionTime',
    type: 'dateRange',
    attr: {
      rangeFormat: ['planEndTimeBegin', 'planEndTimeFinish']
    }
  },
  {
    name: '最近一次调整的数据状态',
    value: 'auditStatus',
    type: 'select',
    data: auditStatusList
  }
]
// 表头
const columns = [
  {
    title: '序号',
    width: 80,
    align: 'center',
    customRender: (text, record, index) => {
      return index + 1
    }
  },
  {
    title: '分公司',
    width: 180,
    dataIndex: 'branchName',
    customRender: (text, record, index) => {
      return record.branchName || record.branchComName
    }
  },
  {
    title: '项目部',
    width: 260,
    dataIndex: 'projectName'
  },
  {
    title: '所属月度',
    width: 260,
    dataIndex: 'belongMonth'
  },
  {
    title: '阶段/类别',
    width: 260,
    dataIndex: 'stageCategory'
  },
  {
    title: '业务事项',
    width: 200,
    dataIndex: 'businessMatters'
  },
  {
    title: '管控级别',
    width: 80,
    dataIndex: 'controlLevelName'
  },
  {
    title: '计划开始时间',
    width: 120,
    dataIndex: 'planStartTime'
  },
  {
    title: '计划完成时间',
    width: 120,
    dataIndex: 'planEndTime'
  },
  {
    title: '节点状态',
    width: 160,
    dataIndex: 'nodeStatus',
    customRender: (text, record, index) => {
      return nodeStatusList.find(el => el.value == text)?.label || ''
    }
  },
  {
    title: '当前逾期次数',
    width: 120,
    dataIndex: 'warningNum'
  },
  {
    title: '最近一次调整后计划完成时间',
    width: 160,
    dataIndex: 'adjustCompletionTime'
  },
  {
    title: '最近一次调整的数据状态',
    width: 160,
    dataIndex: 'auditStatus',
    customRender: (text, record, index) => {
      return auditStatusList.find(el => el.value === text)?.label || ''
    }
  },
  {
    title: '操作',
    dataIndex: 'operation',
    width: 200,
    fixed: 'right',
    scopedSlots: { customRender: 'operation' }
  }
]

// 操作表单项（周计划）
const detailFormOption = [
  {
    label: '所属单位',
    keyName: 'projectId',
    type: 'orgTree',
    span: 16,
    isAutoSelectFirst: true,
    isNeedAuth: true,
    checkStrictly: true,
    disabled: true
  },
  {
    label: '创建时间',
    keyName: 'createTime',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '阶段类别',
    keyName: 'stageCategory',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '业务事项',
    keyName: 'businessMatters',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '管控级别',
    keyName: 'controlLevelName',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '所属月度',
    keyName: 'belongMonth',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '计划开始时间',
    keyName: 'planStartTime',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '计划完成时间',
    keyName: 'planEndTime',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '节点状态',
    keyName: 'nodeStatus',
    type: 'BaseInput',
    disabled: true
  }
]
// 节点预警信息表头
const detailColumns = [
  {
    title: '逾期次数',
    width: 160,
    align: 'center',
    dataIndex: 'warningNum'
  },
  {
    title: '逾期原因',
    dataIndex: 'typeName'
  },
  {
    title: '调整后计划完成时间',
    width: 160,
    align: 'center',
    dataIndex: 'adjustCompletionTime'
  },
  {
    title: '保障措施',
    dataIndex: 'measure'
  },
  {
    title: '创建人',
    width: 160,
    align: 'center',
    dataIndex: 'creatorName'
  },
  {
    title: '创建时间',
    width: 160,
    align: 'center',
    dataIndex: 'createTime'
  },
  {
    title: '状态',
    width: 160,
    align: 'center',
    dataIndex: 'auditStatus',
    customRender: (text, record, index) => {
      return auditStatusList.find(el => el.value === text)?.label || ''
    }
  },
  {
    title: '操作',
    dataIndex: 'operation',
    width: 160,
    align: 'center',
    scopedSlots: { customRender: 'operation' }
  }
]

// 节点预警信息编辑表单项
const updateFormOption = [
  {
    label: '逾期原因',
    keyName: 'reason',
    type: 'BaseInput',
    span: 24,
    attrs: {
      maxLength: 3000
    },
    rules: [{ required: true, message: '请输入', trigger: 'change' }]
  },
  {
    label: '调整后计划完成时间',
    keyName: 'adjustCompletionTime',
    slot: true,
    rules: [{ required: true, message: '请选择', trigger: 'change' }]
  },
  {
    label: '保障措施',
    keyName: 'measure',
    type: 'BaseTextarea',
    span: 24,
    attrs: {
      maxLength: 3000
    },
    rules: [{ required: true, message: '请输入', trigger: 'change' }]
  }
]

export { searchOption, columns, detailFormOption, detailColumns, auditStatusList, nodeStatusList, updateFormOption }
